<?php

declare(strict_types=1);

namespace App\Request\Client\User;

use App\Constants\DefaultValue;
use App\Constants\Model\UserGoldLog;
use Hyperf\Validation\Request\FormRequest;
use Hyperf\Validation\Rule;

class GoldListRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'perPage' => [
                'integer',
                'min:0',
                'not_in:0',
                "max:" . DefaultValue::PER_PAGE_MAX
            ],
            'type' => [
                'required',
                Rule::in(
                    [
                        UserGoldLog::TYPE_COMMISSION,
                        UserGoldLog::TYPE_AWARD
                    ]
                )
            ]
        ];
    }

}